﻿Public Class frmStockCardList
    Dim dbBase As New dbStockCard
    Dim frmCtrl As New FormControl
    Dim dsBase As DataSet
    Dim EntryID As String

    Private Sub frmStockCardList_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.WindowState = FormWindowState.Maximized
        EntryID = ""
        GridAndFind1.Enabled = True
        dsBase = dbBase.GetBaseList()
        ToolbarHeader1.Iniliaze("LIST : Stock Card", Me, Nothing, GridAndFind1.getDataGridView(), "Code")
        GridAndFind1.Initialize(dsBase, "Code", ToolbarHeader1, Me, True)
        If (dsBase IsNot Nothing) Then

        End If
        ToolbarHeader1.ActionCtrl(True, True, True, False, True, False, False, True, True)
    End Sub

    Private Sub tsNew_Click(ByVal sender As Object) Handles ToolbarHeader1.tsNewClick
        Dim OpenForm As New frmCustomerEntry
        OpenForm.EntryID = ""
        frmCtrl.OpenFormDetail(Me, OpenForm)
    End Sub

    Private Sub GridCellEnter_Click(ByVal sender As GridAndFind, KeyValue As String) Handles GridAndFind1.GridCellEnter
        Dim dvFind As DataView = New DataView(dsBase.Tables(0))
        dvFind.RowFilter = "[Code] = '" & KeyValue & "'"
        EntryID = dvFind.Item(0).Row("Code").ToString()
    End Sub

    Private Sub GridDoubleClick_Click(ByVal sender As GridAndFind) Handles GridAndFind1.GridDoubleClick
        Dim OpenForm As New frmCustomerEntry
        OpenForm.EntryID = EntryID
        frmCtrl.OpenFormDetail(Me, OpenForm)
    End Sub

    Private Sub tsEdit_Click(ByVal sender As Object) Handles ToolbarHeader1.tsEditClick
        Dim OpenForm As New frmCustomerEntry
        OpenForm.EntryID = EntryID
        frmCtrl.OpenFormDetail(Me, OpenForm)
    End Sub

    Private Sub tsPrint_Click(ByVal sender As Object) Handles ToolbarHeader1.tsPrintClick
        ''Event 
    End Sub

    Private Sub tsRefresh_Click(ByVal sender As Object) Handles ToolbarHeader1.tsRefreshClick
        frmCtrl.openChild(New frmCustomerList, Me.ParentForm)
    End Sub
End Class